#pragma once

#include <Windows.h>
#include <string>
#include "pipemessage.h"

// Esta mensagem serve para ambos o Top10 e as estatisticas de jogo
using namespace std;
class TopMessage : public PipeMessage
{
public:
	typedef struct STopElement
	{
		bool isSet;
		char username[15];
		ULONG totalPoints;
		UINT bestScore;
		USHORT numberPlayedGames;
	} TopElement;

private:
	TopElement mData[15];

protected:
	virtual UINT CreateBuffer(UINT _startPos = 0);
	virtual void ParseBuffer();
	virtual UINT GetBufferSize();

public:
	TopMessage(MessageType _type, BYTE* _buffer = NULL);


public:
	virtual void SetPlayer(string _username, ULONG _totalPoints, UINT _pos, UINT _bestScore = 0, USHORT _numberPlayedGames = 0 );

	const TopElement& Data(UINT _pos) const { return mData[_pos]; }
	
};

